home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compendium Deluxe 2
/
LSD and 17bit Compendium Deluxe - Volume II.iso
/
a
/
prog
/
asmsrc
/
diskfont.lha
/
diskfontdemo.s
Wrap
Text File
|
1994-06-05
|
4KB
|
187 lines
section lard,code
opt d+,c+
;example of using DISKFONT library to change font in a window/screen
;done for OZRIK from bristol (forgot your group!)
code: include dh0:include/system
Lea GFXName,A1
Moveq #0,D0
CALLEXEC OpenLibrary
Move.l D0,_GfxBase
Beq Error
Lea DosName,A1
Moveq #0,D0
CALLEXEC OpenLibrary
Move.l D0,_DOSBase
Beq Error
Lea IntName,A1
Moveq #0,D0
CALLEXEC OpenLibrary
Move.l D0,_IntuitionBase
Beq Error
Lea DFontName,a1
Moveq #0,D0
CALLEXEC OpenLibrary
Move.l D0,_DiskfontBase
lea BodyFont,a0
CALLDISKFONT OpenDiskFont
move.l d0,BodyFontHandle
*-----------------------------------------------*
move.l NEWSCREEN,a0
CALLINT OpenScreen
Move.l D0,_MyScrBase
Beq CloseInt
move.l NEWWINDOW,a0
move.l d0,nw_Screen(a0)
CALLINT OpenWindow
Move.l D0,_MyWinBase
Beq CloseInt
Move.l D0,A0
Move.l wd_RPort(A0),_MyWinRPort
Move.l wd_UserPort(a0),_MyWinUserPort
*-----------------------------------------------*
.WaitLoop Move.l _MyWinUserPort,A0
CALLEXEC WaitPort
Move.l _MyWinUserPort,A0
CALLEXEC GetMsg
Move.l D0,A1
Move.l im_Class(A1),D2 ;D2=IDCMP Flags Directly
Move.w im_Code(A1),D3 ;D3=Data ie key why class=Rawkey
Move.w im_Qualifier(A1),D4 ;D4=things like CTRL SHIFT
Move.w im_MouseX(a1),D5 ;D5=MouseX Coordinate
Move.w im_MouseY(a1),D6 ;D5=MouseY Coordinate
Move.l im_IAddress(A1),D7 ;D7=Addres of Intuition Obj ie Gadget
Movem.l D0-D7/A0-A6,-(A7)
CALLEXEC ReplyMsg
Movem.l (a7)+,D0-D7/A0-A6
Cmp.l #CLOSEWINDOW,D2
bne .WaitLoop
.Exit Move.l _MyWinBase,A0
CALLINT CloseWindow
Move.l _MyScrBase,A0
CALLINT CloseScreen
*-------------------------------*
CloseInt Move.l _IntuitionBase,A1
CALLEXEC CloseLibrary
Move.l _DOSBase,A1
CALLEXEC CloseLibrary
Move.l _DiskfontBase,A1
CALLEXEC CloseLibrary
move.l BodyFontHandle,a1
CALLGRAF CloseFont
move.l BodyFontHandle,a1
CALLGRAF RemFont
Move.l _GfxBase,A1
CALLEXEC CloseLibrary
*-------------------------------*
Error Moveq #0,D0
Rts
*-------------------------------*
_MyScrBase Dc.l 0
_MyWinBase Dc.l 0
_MyWinRPort Dc.l 0
_MyWinUserPort Dc.l 0
_MyWinVPort Dc.l 0
BodyFontHandle: dc.l 0
_IntuitionBase dc.l 0
_DOSBase dc.l 0
_GfxBase dc.l 0
_DiskfontBase dc.l 0
GFXName GRAFNAME
IntName INTNAME
DosName DOSNAME
DFontName DISKFONTNAME
even
BodyFont: dc.l BodyFontName
dc.w 8
dc.b 0 ; style
dc.b 0 ; flags
BodyFontName:
dc.b 'DPaint.font',0
cnop 0,2
*---------------------------------------------------
* Gadgets created with PowerSource V3.0
* which is (c) Copyright 1990-91 by Jaba Development
* written by Jan van den Baard
*---------------------------------------------------
RenderTexts0:
DC.B 1,0
DC.B $00
DC.W 17,23
DC.L BodyFont
DC.L RenderTextsIText0
DC.L 0
RenderTextsIText0:
DC.B 'Hi martin, this is some text',0
CNOP 0,2
SpecialGadget:
DC.L 0
DC.W 0,0,1,1,$0003,0,$0001
DC.L 0,0,RenderTexts0,0,0
DC.W 0
DC.L 0
MyNewScreen:
DC.W 0,0,640,256
DC.W 2
DC.B -1,-1
DC.W $8000
DC.W $0001
DC.L 0,0,0,0
new_window:
DC.W 50,25,407,58
DC.B 0,1
DC.L $00000260
DC.L $0002100F
DC.L SpecialGadget,0
DC.L new_window_title
DC.L 0,0
DC.W 150,50,640,256,$000F
new_window_title:
DC.B 'Work Window',0
CNOP 0,2
NEWWINDOW: DC.L new_window
WDBACKFILL EQU 0
NEWSCREEN: DC.L MyNewScreen
FIRSTTEXT: DC.L RenderTexts0